package my.tool;

import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2010-6-10
 * Time: 17:36:02
 * To change this template use File | Settings | File Templates.
 */
public class ConfigProp {
    private static Properties config = new Properties();

    static {
        try {
            File file = new File(ConfigUtil.getClassPath() + "config.properties");
            if (file != null && file.exists() && file.isFile()) {
                FileInputStream fi = new FileInputStream(file);
                config.load(fi);
                fi.close();
                System.out.println("****************** init global config properties ... ok ******************");
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("****************** init global config properties ... error!!!");
        }
    }

    public static String getProperties(String key) {
        return config.getProperty(key, "").trim();
    }
}
